$(function () {
    $("#page_btn").click(function () {
        window.location.href = 'invite'
    });

    queryRecord(1);

    $("#nextPage").click(function () {
        console.log('next page')
        nextPage();
    });

    $("#prePage").click(function () {
        prePage();
    });

})

function nextPage() {
    var pageNum = parseInt($("#pageNumber").val())
    var pages = parseInt($("#pages").val());
    if (pageNum < pages) {
        queryRecord(pageNum + 1);
    } else {
        console.log("no next page")
    }
}

function prePage() {
    var pageNum = parseInt($("#pageNumber").val())
    var pages = parseInt($("#pages").val());
    if (pageNum > 1) {
        queryRecord(pageNum - 1);
    }
}

function queryRecord(page_num) {
    var data = {
        pageNum: page_num,
        pageSize: 10
    }

    $.ajax({
        type: "get",
        url: "../money/getWithDrawRecord",
        dataType: "json",
        contentType: "application/json",
        data: data,
        success: function (msg) {
            console.log(msg.data)
            var ll = msg.data.list;
            var res = "";
            for (var i = 0; i < ll.length; i++) {
                res += "<li data-v-0216c0c3=\"\" kay=\"a147710920230205442762\">\n" +
                    "                        <ol data-v-0216c0c3=\"\"><p data-v-0216c0c3=\"\">₹ " + ll[i].amount + "</p>\n" +
                    "                        </ol>\n" +
                    "                        <ol data-v-0216c0c3=\"\"><p data-v-0216c0c3=\"\">" + ll[i].id + "</p>\n" +
                    "                            <p data-v-0216c0c3=\"\" class=\"times\"></p></ol>\n" +
                    "                        <ol data-v-0216c0c3=\"\"><p data-v-0216c0c3=\"\" class=\"oddnum\">" + ll[i].createTime + "</p>\n" +
                    "                            <div data-v-0216c0c3=\"\"></div>\n" +
                    "                        </ol>\n" +
                    "                    </li>";
            }
            $("#withdraw_list").html(res);
            $("#pageNumber").val(msg.data.pageNum);
            $("#pages").val(msg.data.pages);
            $("#currentPage").html(msg.data.pageNum);
        }
    })
}